---------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\sbstjp\OneDrive - Cardiff University\FinalHarvard\Appendix8.5.log
  log type:  text
 opened on:  12 May 2025, 18:24:49

. use "C:\Users\sbstjp\OneDrive - Cardiff University\PVScleandata.dta" // Prosser, Magasin, Proulx and Haddock,
>  UK Progressive Values Dataset, April 2024 // Accessed on March 16 2025

. 
. // Create a weight
. gen weight = 1

. 
. * Code variables into categories
. recode age (min/24=1 "0-24") (25/34=2 "25-34") (35/44=3 "35-44") (45/54=4 "45-54") (55/max=5 "55+"), generate
> (age_group)
(672 differences between age and age_group)

. recode ethnicity (1=1) (2=2) (3=3) (5=4) (6=4) (7=4) (4=5) (8=6), generate(ethnic_group)
(243 differences between ethnicity and ethnic_group)

. label define ethnic_group_lbl 1 "White" 2 "Black" 3 "Hispanic" 4 "Asian or Native Hawaiian/other Pacific Isla
> nder, non-Hispanic" 5 "Native American/Alaska Native or other race, non-Hispanic" 6 "Multiple races, non-Hisp
> anic"

. label values ethnic_group ethnic_group_lbl

. recode education (3=1) (4=1) (5=1) (6=2) (7=2) (8=3) (9=4) (10=4) (11=4), generate(ed_group)
(672 differences between education and ed_group)

. recode householdincome (1=1) (2=1) (3=1) (4=1) (5=1) (6=1) (7=1) (8=2) (9=2) (10=2) (11=2) (12=3) (13=4), gen
> erate(inc_group)
(621 differences between householdincome and inc_group)

. 
. * Generate totals for the weights - these are based on the ANES24 pre-election wave as this dataset has polit
> ical selfid, unlike census data. The below are for 1-4, i.e. very liberal to centrist, on the political selfi
> d scale. This mirrors the PVS sample. 
. 
. replace gender=. if inrange(gender, 3, 5)
(34 real changes made, 34 to missing)

. rename gender FemaleGender

. gen sextot=.
(672 missing values generated)

. replace sextot = 0.4663 if FemaleGender == 1 // Male
(211 real changes made)

. replace sextot = 0.5337 if FemaleGender == 2 // Female
(427 real changes made)

. 
. gen agetot=.
(672 missing values generated)

. replace agetot = 0.1227 if age_group == 1 //18-24
(110 real changes made)

. replace agetot = 0.1848 if age_group == 2 //25-34
(218 real changes made)

. replace agetot = 0.1891 if age_group == 3 //35-44
(160 real changes made)

. replace agetot = 0.1544 if age_group == 4 //45-54
(111 real changes made)

. replace agetot = 0.3491 if age_group == 5 //55+
(73 real changes made)

. 
. gen ethtot=. 
(672 missing values generated)

. replace ethtot = 0.6038 if ethnic_group == 1 // White
(154 real changes made)

. replace ethtot = 0.1186 if ethnic_group == 2 // Black
(153 real changes made)

. replace ethtot = 0.1592 if ethnic_group == 3 // Hispanic
(121 real changes made)

. replace ethtot = 0.0659 if ethnic_group == 4 // Asian or Native Hawaiian
(150 real changes made)

. replace ethtot = 0.0024 if ethnic_group == 5 // Native American
(19 real changes made)

. replace ethtot = 0.0502 if ethnic_group == 6 // Multiple
(74 real changes made)

. 
. gen edtot=.
(672 missing values generated)

. replace edtot = 0.4408 if ed_group == 1 // Uptosomecollege
(219 real changes made)

. replace edtot = 0.0926 if ed_group == 2 // Trade/assocdegree
(90 real changes made)

. replace edtot = 0.2754 if ed_group == 3 // Undergraddegree
(253 real changes made)

. replace edtot = 0.1912 if ed_group == 4 // Postgradandabove
(110 real changes made)

. 
. gen inctot=.
(672 missing values generated)

. replace inctot = 0.2528 if inc_group == 1 //under 60k
(352 real changes made)

. replace inctot = 0.2084 if inc_group  == 2 //60-100k
(190 real changes made)

. replace inctot = 0.1966 if inc_group  == 3 //100-150k
(76 real changes made)

. replace inctot = 0.3422 if inc_group  == 4 //over 150k
(54 real changes made)

. 
. * Rake the weights using the Stata survwgt package
. survwgt rake weight , by(FemaleGender age_group ethnic_group ed_group inc_group) totvars(sextot agetot ethtot
>  edtot inctot) generate(rakedweight)

. 
. // Demographics
. *Generate dummies
. gen Graduate=. 
(672 missing values generated)

. replace Graduate=0 if inrange(education, 3, 7)
(309 real changes made)

. replace Graduate=1 if inrange(education, 8, 11)
(363 real changes made)

. 
. gen BIPOC=. 
(672 missing values generated)

. replace BIPOC=1 if inrange(ethnicity, 2, 8)
(517 real changes made)

. replace BIPOC=0 if ethnicity==1
(154 real changes made)

. 
. // Standardize and rename
. egen Age = std(age)

. egen Income = std(householdincome)

. egen PVS = std(pvs)

. 
. // Standardize dependent variable from 1-2, so it's like others in book
. foreach var in separationofpower {
  2.     summarize `var'
  3.     gen s`var' = 1 + (`var' - r(min)) / (r(max) - r(min))
  4. }

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
separation~r |        672     4.22619    .8951093          1          5

. rename sseparationofpower BranchesOfGov

. 
. // Regressions
. regress BranchesOfGov PVS [pweight= rakedweight], robust
(sum of wgt is 1)

Linear regression                               Number of obs     =        637
                                                F(1, 635)         =       2.05
                                                Prob > F          =     0.1525
                                                R-squared         =     0.0104
                                                Root MSE          =     .19642

------------------------------------------------------------------------------
             |               Robust
BranchesOf~v | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
         PVS |   .0207021   .0144536     1.43   0.153    -.0076805    .0490847
       _cons |   1.847327   .0169794   108.80   0.000     1.813984    1.880669
------------------------------------------------------------------------------

. eststo
(est1 stored)

. regress BranchesOfGov Age BIPOC FemaleGender Graduate Income PVS [pweight= rakedweight], robust
(sum of wgt is 1)

Linear regression                               Number of obs     =        637
                                                F(6, 630)         =       3.23
                                                Prob > F          =     0.0039
                                                R-squared         =     0.0846
                                                Root MSE          =     .18966

------------------------------------------------------------------------------
             |               Robust
BranchesOf~v | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
         Age |   .0073801   .0140976     0.52   0.601    -.0203039    .0350642
       BIPOC |  -.0994758   .0316678    -3.14   0.002     -.161663   -.0372886
FemaleGender |  -.0203536   .0370349    -0.55   0.583    -.0930803    .0523731
    Graduate |   .0192231   .0323222     0.59   0.552    -.0442493    .0826954
      Income |   .0141621   .0139008     1.02   0.309    -.0131355    .0414597
         PVS |    .032187   .0167336     1.92   0.055    -.0006734    .0650474
       _cons |   1.898442   .0733908    25.87   0.000     1.754322    2.042562
------------------------------------------------------------------------------

. eststo
(est2 stored)

. esttab

--------------------------------------------
                      (1)             (2)   
             BranchesOf~v    BranchesOf~v   
--------------------------------------------
PVS                0.0207          0.0322   
                   (1.43)          (1.92)   

Age                               0.00738   
                                   (0.52)   

BIPOC                             -0.0995** 
                                  (-3.14)   

FemaleGender                      -0.0204   
                                  (-0.55)   

Graduate                           0.0192   
                                   (0.59)   

Income                             0.0142   
                                   (1.02)   

_cons               1.847***        1.898***
                 (108.80)         (25.87)   
--------------------------------------------
N                     637             637   
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. 
. log close
      name:  <unnamed>
       log:  C:\Users\sbstjp\OneDrive - Cardiff University\FinalHarvard\Appendix8.5.log
  log type:  text
 closed on:  12 May 2025, 18:24:59
---------------------------------------------------------------------------------------------------------------
